package org.javamianshi.core;

/**
 * Created by Fan on 2017/3/2.
 */
public class Test2 {
    //测试&
    public static void main(String[] args) {
        int x = 5;
        if (x==3 & saySpringok()){      //所有判断条件都会依次执行，不具备短路原则
            System.out.println("true");
        }
        test();
    }
    private static boolean saySpringok(){
        System.out.println("saySpringok");
        return false;
    }

    /**
     * 两个运算的操作数位都为1，结果为1，
     * 否则结果为0
     */
    private static void test(){
        int a = 5;  //101
        int b = 7;  //111
        System.out.println(a&b);
        int c = 4;  //100
        System.out.println(a&c);
        int d = 10;
        System.out.println(a&d);
        //将要计算的数转换为二进制数，然后进行相加，计算完后再转换为原格式输出
    }
}
